package generics.enumtype;

public enum  PayrollDay {
    MONDAY,
    TUESDAY,
    WEDNESDAY,
    THURSDAY,
    FRIDAY,
    SATURDAY,
    SUNDAY;
    private static final int HOURS_PER_SHIFT = 8;
    double pay(double hoursWorked, double payRate) {
        double basePay = hoursWorked * payRate;

        double overTimePay ;
        switch (this) {
            case SATURDAY: case SUNDAY:
                overTimePay =  hoursWorked * payRate /2 ;
            default:
                overTimePay = hoursWorked <= HOURS_PER_SHIFT
                        ? 0: (hoursWorked - HOURS_PER_SHIFT) * payRate / 2;
                break;
        }
        return basePay + overTimePay;
    }

}
